//
//  GridViewItemCookSort.m
//  X-Touch2
//
//  Created by shengchao yang on 12-3-29.
//  Copyright (c) 2012年 foxhis. All rights reserved.
//

#import "GridViewItemCookSort.h"
#import "FileManager.h"
#import "PluSpecialSort.h"
#import "Common.h"

@implementation GridViewItemCookSort
-(id) initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [imageBkg removeFromSuperview];
        imageView.image = [FileManager getImage:@"cooksort_normal_bkg.png" type:3 withRect:imageView.frame];
        [labelName setTextColor:[UIColor blackColor]]; 
    }
    return self;
}
-(void) setData:(id)data{
    PluSpecialSort * temp = (PluSpecialSort *)data;
    [labelName setText:JsonField(temp.pssDescripts)];
}
- (void) setSelectedItem:(BOOL)selected{
    if (selected) {
        imageView.image = [FileManager getImage:@"cooksort_selected_bkg.png" type:3 withRect:imageView.frame];
    }else {
        imageView.image = [FileManager getImage:@"cooksort_normal_bkg.png" type:3 withRect:imageView.frame];
    }
}
- (void)drawRect:(CGRect)rect{
    //设置UIView的背景图片
    [imageView setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    [labelName setFrame:CGRectMake(5, self.frame.size.height*1/4, self.frame.size.width-10, self.frame.size.height/2)];
}
-(void) dealloc{
    [super dealloc];
}
@end
